/**
 * 基本接口,请不要在这文件里加其它接口
 * @param {string} url - 接口
 * @param {string} method - 请求类型
 * @param {string} encrypt - 1 不加密,2 数字信封加密
 * @param {string} headers - 请求头
 * @param {string} data - 参数体
 */

import request from "../request";

const api = {};

const baseUrl = '';

// tgt换取用户信息
api.voteList = function(params) {
    // return request({
    //     url:`./json/test.json`,
    //     method:'get'
    // })
    return request({
        url: baseUrl+'/app-api/voteyear/online/list',
        method: 'get',
        params: params,
        headers: {
            'encrypt': 1
        }
    })
};

api.votedResultList = function(params) {
    // return request({
    //     url:`./json/test.json`,
    //     method:'get'
    // })
    return request({
        url: baseUrl+'/app-api/voteyear/online/votedList?data='+params.data,
        method: 'post',
        data: params,
        headers: {
            'encrypt': 1
        }
    })
};



api.userIsVote = function(params) {
    return request({
        url: baseUrl+'/app-api/voteyear/online/userIsVote',
        method: 'get',
        params: params,
        headers: {
            'encrypt': 1
        }
    })
};

api.voteInfo = function(params) {
    return request({
        url: baseUrl+'/app-api/voteyear/online/voteInfo',
        method: 'get',
        params: params,
        headers: {
            'encrypt': 1
        }
    })
};

api.updateResult = function(data) {
    return request({
        url: baseUrl+'/app-api/voteyear/online/updateResult?data='+data.data,
        method: 'post',
        data: data,
        headers: {
            'encrypt': 1
        }
    })
};

api.getDeptList = function(data) {
    return request({
        url: baseUrl+'/app-api/voteyear/online/getDeptList?data='+data.data,
        method: 'get',
        data: data,
        headers: {
            'encrypt': 1
        }
    })
};

api.ping = function(data) {
    return request({
        // url: baseUrl+'/app-api/voteyear/online/ping',
        url: 'http://10.105.23.34:8081/app-api/voteyear/online/ping',
        method: 'get',
        data: data,
        headers: {
            'encrypt': 1
        }
    })
};


export default api